package com.etc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.etc.dto.ItemsDto;
import com.etc.entity.Order;
import com.etc.service.ItemsService;
import com.etc.tools.ResponseData;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@RestController
@RequestMapping("api")
@Api(value = "订单详情接口", description = "处理订单详情操作的后端接口")
public class ItemDtoController {

	@Autowired
	private ItemsService itemsService;

	@GetMapping("orderitem")
	@ApiOperation(value = "查询订单详情", httpMethod = "GET", notes = "分页的方法", response = ResponseData.class)
	public ResponseData<ItemsDto> listOrder(
			@ApiParam(name = "orderid", required = true, defaultValue = "", value = "订单编号") @RequestParam(name = "orderid", required = true, defaultValue = "") String orderid,
			@ApiParam(name = "page", required = true, defaultValue = "1", value = "页码") @RequestParam(name = "page", required = true, defaultValue = "1") Integer page,
			@ApiParam(name = "limit", required = true, defaultValue = "10", value = "每页记录数") @RequestParam(name = "limit", required = true, defaultValue = "10") Integer limit) {

		ResponseData<ItemsDto> rd = itemsService.queryItemsOrder(page, limit, orderid);
		return rd;
	}

}
